from abc import ABCMeta, abstractmethod

from ..container import ComponentContainer


class AbstractDataEvaluator(metaclass=ABCMeta):

    def __call__(self, container: ComponentContainer):
        model = container.model
        data = container.data
        container.pred = self.evaluate(data, model)

    @abstractmethod
    def evaluate(self, data, model):
        pass


class ClsDataEvaluator(AbstractDataEvaluator):

    def evaluate(self, data, model):
        # data, label
        data, _ = data
        return model(data)
